﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="接箍出库单录入.aspx.cs" Inherits="syc.Fc.接箍出库单录入" %>
<html>
<head>
<title></title>
<style> 
tr{height:35px;}
</style>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="select @类别ID=产品类别ID,@日期=日期,@分厂ID=生产单位ID,@支数=支数合计,@重量=cast(重量合计 as float),@备注=备注,@供货ID=供货ID,@炉号=炉号 from 自产接箍判定单 where ID=@ID and 支数合计<0"

InsertCommand="insert into 自产接箍判定单(产品类别ID,日期,生产单位ID,支数合计,重量合计,备注,录入,合格,供货ID,炉号)
values(@类别ID,@日期,@分厂ID,-@支数,-@重量,@备注,@录入,1,@供货ID,@炉号);select @ID=@@IDENTITY;"

UpdateCommand="update 自产接箍判定单 set 产品类别ID=@类别ID,日期=@日期,生产单位ID=@分厂ID
,支数合计=-@支数,重量合计=-@重量,录入=@录入,备注=@备注,供货ID=@供货ID,炉号=@炉号 where ID=@ID"

ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" onselected="SqlDataSource1_Selected" 
 >
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" />
<asp:Parameter Name="类别ID" DbType="Int32"  Size="4" Direction="Output"/>
<asp:Parameter Name="日期" DbType="Date"  Size="3" Direction="Output"/>
<asp:Parameter Name="分厂ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="支数" DbType="Int32" Size="4" Direction="Output"/>
<asp:Parameter Name="重量" DbType="double" Size="8" Direction="Output"/>
<asp:Parameter Name="备注" DbType="String"  Size="40" Direction="Output" />
<asp:Parameter Name="供货ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="炉号" DbType="AnsiString" Size="15" Direction="Output" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" Direction="Output" ControlID="BillID" />
<asp:ControlParameter Name="类别ID" DbType="Int32"  Size="4" ControlID="LeiBie" />
<asp:ControlParameter Name="日期" DbType="Date"  Size="3" ControlID="Date1" />
<asp:ControlParameter Name="分厂ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="支数" DbType="Int32" Size="4" ControlID="ZhiShu" />
<asp:ControlParameter Name="重量" DbType="Decimal" Size="5" ControlID="ZhongLiang" />
<asp:Parameter Name="录入" DbType="String"  Size="20" />
<asp:ControlParameter Name="备注" DbType="String"  Size="40" ControlID="BeiZhu" />
<asp:ControlParameter Name="供货ID" DbType="Int32" Size="4" ControlID="GongHuo" />
<asp:ControlParameter Name="炉号" DbType="AnsiString" Size="15" ControlID="LuHao" />

</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="BillID" />
<asp:ControlParameter Name="类别ID" DbType="Int32"  Size="4" ControlID="LeiBie" />
<asp:ControlParameter Name="日期" DbType="Date"  Size="3" ControlID="Date1" />
<asp:ControlParameter Name="分厂ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="支数" DbType="Int32" Size="4" ControlID="ZhiShu" />
<asp:ControlParameter Name="重量" DbType="Decimal" Size="5" ControlID="ZhongLiang" />
<asp:Parameter Name="录入" DbType="String"  Size="20" />
<asp:ControlParameter Name="备注" DbType="String"  Size="40" ControlID="BeiZhu" />
<asp:ControlParameter Name="供货ID" DbType="Int32" Size="4" ControlID="GongHuo" />
<asp:ControlParameter Name="炉号" DbType="AnsiString" Size="15" ControlID="LuHao" />
</UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID], [名称] FROM [原料供货单位]" >
</asp:SqlDataSource>


<asp:Label ID="BillID" runat="server" Text="0" Visible="False"></asp:Label>

<div id="wintop" class="wintop" style="display:none;">接箍出库单录出</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
<asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Save_Click"  />

<asp:Button ID="Button_Close" runat="server" Text="关 闭" UseSubmitBehavior="false"  Visible="true"
        CssClass="button" OnClientClick="parent.swin2_close();return false;" />

</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" HorizontalAlign="Center">

<table id=mt border=1 style="border-collapse:separate;font-size:14px;margin-top:10px;margin-bottom:24px;">
<tr>
<td colspan=4 align=center style="font-weight:bold; letter-spacing:10px;font-size:16px;border:none;">接箍出库</td>
</tr>

<tr>
<td align=right>接收分厂：</td>
<td><asp:DropDownList ID="FenChang" runat="server" Width="120">
<asp:ListItem Value="1">一分厂</asp:ListItem>
<asp:ListItem Value="2">二分厂</asp:ListItem>
<asp:ListItem Value="5">五分厂</asp:ListItem>
</asp:DropDownList></td>
<td align=right>日 期：</td>
<td><asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="120"></asp:TextBox><img alt="" src="/Icons/29.png" align="absmiddle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" /></td>
</tr>

<tr>
<td align=right width=90>产品类别：</td>
<td width=160><asp:DropDownList ID="LeiBie" runat="server" Width="120">
<asp:ListItem Value="1">油管接箍(J55)</asp:ListItem>
<asp:ListItem Value="2">套管接箍(J55)</asp:ListItem>
<asp:ListItem Value="3">油管接箍(N80Q)</asp:ListItem>
<asp:ListItem Value="4">套管接箍(N80Q)</asp:ListItem>
</asp:DropDownList></td>
<td align=right width=90>规 格：</td>
<td width=160>5 - 1/2"</td>
</tr>

<tr>
<td align=right>原料供货：</td>
<td><asp:DropDownList ID="GongHuo" runat="server" Width="120" DataSourceID="SqlDataSource2" DataTextField="名称" DataValueField="ID"></asp:DropDownList>
</asp:Panel></td>
<td align=right>炉 号：</td>
<td><asp:TextBox ID="LuHao" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
</tr>

<tr>
<td align=right>支 数：</td>
<td><asp:TextBox ID="ZhiShu" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
<td align=right>重量(kg)：</td>
<td><asp:TextBox ID="ZhongLiang" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
</tr>

<tr>
<td align=right>备 注：</td>
<td colspan="3"><asp:TextBox ID="BeiZhu" runat="server" CssClass="textbox" Width="378"></asp:TextBox></td>
</tr>

</table>


</form>

<script >
    var notice = '<%=this.Notice %>';
    if (notice!='')
    {
        parent.showmsgbox(notice);
    }
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.id == "BeiZhu") return;

        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
            if (e.keyCode == 13) e.keyCode = 9;
        }
    }

    function makecalendar(d, o) {
        obj = o;
        idate = makedate(d);
        cdate = new Date(idate.getFullYear(), idate.getMonth(), 1);
        ds.style.left = (getObjectLeft(o)-43) + "px";
        ds.style.top = (getObjectTop(o) - 20) + "px";
        ds.style.display = 'block';
        showcalendar();
    }
    function LeibieChange() {
        var gg = document.getElementById("mt").rows[2].cells[3];
        if (document.getElementById("LeiBie").selectedIndex == 0 || document.getElementById("LeiBie").selectedIndex == 2) {
            gg.innerHTML = "88.9×12.5";
        }
        else {
            gg.innerHTML = "153.67×13";
        }
        ZhiShuChange();
    }
    function ZhiShuChange() {
        if (document.getElementById("LeiBie").selectedIndex == 0) {
            document.getElementById("ZhongLiang").value = fixFloat(document.getElementById("ZhiShu").value * 2.3,1);
        }
        else {
            document.getElementById("ZhongLiang").value = fixFloat(document.getElementById("ZhiShu").value * 6.1,1);
        }
    };
    document.getElementById("LeiBie").onchange = LeibieChange;
    LeibieChange();
    document.getElementById("ZhiShu").onchange = ZhiShuChange;
</script>
</body>
</html>
